Markdown and sploiler in roomlist + spoiler in notifications#4483
Merged
Markdown and sploiler in roomlist + spoiler in notifications#4483
Conversation
Make notifications spoiler aware
bmarty
commented
Nov 17, 2021
| extractUsefulTextFromReply(lastContentBody) | ||
| } else { | ||
| lastContent?.body ?: "" | ||
| lastContentBody |
Member
Author
There was a problem hiding this comment.
Just a small clean up here, should not change anything.
bmarty
commented
Nov 17, 2021
| ?: newContent?.toModel<MessageContent>()?.body | ||
| ?: (this as MessageTextContent?)?.matrixFormattedBody?.let { ContentUtils.formatSpoilerTextFromHtml(it) } | ||
| ?: body | ||
| } |
Member
Author
There was a problem hiding this comment.
This fun should now be used when we want to display an Event, but not when user wants to edit it
bmarty
commented
Nov 17, 2021
| } | ||
|
|
||
| @Suppress("RegExpRedundantEscape") | ||
| fun formatSpoilerTextFromHtml(formattedBody: String): String { |
Member
Author
There was a problem hiding this comment.
This would deserve some unit test...
Contributor
There was a problem hiding this comment.
although it uses androidx.core.text.HtmlCompat.fromHtml so we wouldn't be able to write a unit test unless we use a java equivalent
bmarty
commented
Nov 17, 2021
| MessageType.MSGTYPE_FILE -> { | ||
| return simpleFormat(senderName, stringProvider.getString(R.string.sent_a_file), appendAuthor) | ||
| } | ||
| MessageType.MSGTYPE_TEXT -> { |
Member
Author
There was a problem hiding this comment.
Moved to the beginning since this is the most common case
bmarty
commented
Nov 17, 2021
| EventType.STICKER -> { | ||
| return simpleFormat(senderName, stringProvider.getString(R.string.send_a_sticker), appendAuthor) | ||
| } | ||
| EventType.REACTION -> { |
Member
Author
There was a problem hiding this comment.
Move below since this is less common than EventType.MESSAGE
ouchadam
approved these changes
Nov 17, 2021
Member
Author
|
I squash the commits for a cleaner Git history |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replacement for #4426 and #2694